

<script>
import { h, ref } from 'vue'
import helloWorld from './render函数使用插槽/helloWorld.vue'
export default {
  components:{
    helloWorld
  },
  setup() {
    let counter = ref(0)
    const increment = () => {
      counter.value++
    }
    const decrement = () => {
      counter.value--
    }
    return {
      counter,
      increment,
      decrement
    }
  },
  render() {
    return (
      <div>
        <h2>当前计数：{this.counter}</h2>
        <button onClick= { this.increment } >+1</button>
        <button onClick= { this.decrement } >-1</button>
        <helloWorld>
         {{ default:(props) => <div>我是插槽 {props.message}</div> }}
        </helloWorld>
      </div>
    )
   
  }
}
</script>

<style>

</style>